package com.bjwl.service.impl;

import com.bjwl.dao.StaffMapper;
import com.bjwl.pojo.Business;
import com.bjwl.pojo.Staff;
import com.bjwl.pojo.vo.AdminOrdersQueryVo;
import com.bjwl.service.StaffService;
import com.bjwl.utils.PageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author: dzx
 * @Date:Create：in 2020/4/10 9:46
 * @Description:
 * @Modified By：
 * @Version: 1.0
 */
@Service
public class StaffServiceImpl implements StaffService {

    @Autowired
    private StaffMapper staffMapper;



    @Override
    @Transactional
    public PageBean<Staff> findStaffByBstoreid(Integer pageNum, Integer bssign,Integer staffid,String staffvalue,String wstarttime,String wendtime) {
        PageBean<Staff> pageBean = new PageBean(pageNum,5,staffMapper.getTotalRecordBr(bssign,staffid,staffvalue,wstarttime,wendtime));
        pageBean.setData(staffMapper.findAllStaffBr(pageBean,bssign,staffid,staffvalue,wstarttime,wendtime));
        return pageBean;
    }
    @Override
    @Transactional
    public Staff updateShowStaff(Integer sid) {
        return staffMapper.updateShowStaff(sid);
    }

    @Override
    @Transactional
    public void updateStaffByid(Staff staff) {
        staffMapper.updateStaffByid(staff);
    }

    @Override
    @Transactional
    public PageBean<Staff> findAllStaff(AdminOrdersQueryVo adminOrdersQueryVo) {
        PageBean<Staff> pageBean = new PageBean<Staff>(adminOrdersQueryVo.getPageNum(),5,staffMapper.getTotalRecord(adminOrdersQueryVo));
        pageBean.setData(staffMapper.findAllStaff(pageBean,adminOrdersQueryVo));

        return pageBean;
    }

    /**
     * 添加staff
     * @param staff
     */
    @Override
    @Transactional
    public void addStaff(Staff staff) {
        staffMapper.addStaff(staff);
    }

    @Override
    public void deleteStaff(Integer sid) {
        staffMapper.deleteStaff(sid);
    }
    @Override
    public Integer findAllStaffTotalRecord() {
        return staffMapper.findAllStaffTotalRecord();
    }
    @Override
    public Integer staffCount(Integer bssign) {
        return staffMapper.staffCount(bssign);
    }

    @Override
    public PageBean<Staff> findStaffByBstoreidSettle(Integer pageNum, Integer bssign, Integer card ,String staffname) {
        PageBean<Staff> pageBean = new PageBean(pageNum,5,staffMapper.getTotalRecordBrSettle(bssign,card,staffname));
        pageBean.setData(staffMapper.findAllStaffBrSettle(pageBean,bssign,card ,staffname));
        return pageBean;
    }

    @Override
    public Staff finStaffByCard(Integer bssign ,String staffname) {
        return staffMapper.finStaffByCard(bssign ,staffname);
    }

    @Override
    public Integer findAllStaffByCard(Integer card) {
        return staffMapper.findAllStaffByCard(card);
    }

    @Override
    public List<Staff> findAllStaffSettle(Integer bssign) {
        return staffMapper.findAllStaffSettle(bssign);
    }

    @Override
    public Staff finStaffByCardS(Integer bssign, String card) {
        return staffMapper.finStaffByCardS(bssign,card);
    }


    /*
    @Override
    public PageBean<Staff> findStaffBySettle(Integer pageNum, Integer bssign, String staffname, Integer card) {
        PageBean<Staff> pageBean = new PageBean(pageNum,5,staffMapper.getTotalRecordBrStaff(bssign,staffname,card));
        pageBean.setData(staffMapper.findStaffBySettle(pageBean,bssign,staffname,card));
        return pageBean;
    }
*/
}
